<include file="public:header" />
<div class="allpagetop">网站配置<strong>/</strong>问题分类<strong>/</strong>修改</div>
<div class="admin_main_nr_dbox">
<div class="pagetit">
	        <div class="ptit">修改</div>
				<div class="topnav">
			        <a href="{:RU('Category/cat_question',array('c_type'=>$c_type))}" <if condition="ACTION_NAME eq 'cat_question'">class="select"</if>>列表</a>
					   <a href="{:RU('Category/cat_question_add',array('c_type'=>$c_type))}" <if condition="ACTION_NAME eq 'cat_question_add'">class="select"</if>>添加</a>
				    <div class="clear"></div>
				</div>
	        <div class="clear"></div>
  </div>
		
		
    <div class="toptit">修改问题分类</div>
  <form action="{:RU('Category/cat_question_edit')}" method="post"   name="FormData" id="FormData" >
  <input name="url" type="hidden" value="{:RU('Category/cat_question',array('c_type'=>$show['c_type']))}" />
  <input name="c_type" type="hidden" value="{$show.c_type}" />
  <input name="c_id" type="hidden" value="{$show.c_id}" />
  <input name="c_pid" type="hidden"  id="c_pid" value="{$show.c_pid|default='0'}" />
	  <div class="admin_form_main">
	  
	    <div class="fl">分类名称:</div>
		<div class="fr"><input name="c_title" type="text"  class="input_text_default" maxlength="60" placeholder="请输入分类名称" value="{$show.c_title}"/></div>
		<div class="fl">分类排序:</div>
		<div class="fr">
		<input name="c_sort" type="text"  class="input_text_default"  maxlength="8" onkeyup="if(event.keyCode !=37 && event.keyCode != 39) value=value.replace(/\D/g,'');"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))"   placeholder="数字越大越靠前，默认是0"  value="{$show.c_sort}"/>
		</div>
		<div class="fl">所属分类:</div>
			<div class="fr"><input name="c_pid_cn" id="c_pid_cn" type="text"  class="input_text_default J_cat_show" maxlength="60" placeholder="请选择所属分类" readonly="readonly" value="{$c_pid_cn|default='顶级分类'}"/></div>

		 
		<div class="fl">上传图标:</div>
		 <div class="fr"  id="up_img_show">
		  <input name="c_pic" type="hidden" value="{$show.c_pic}"  />
		 
		 <if condition="$show.c_pic neq ''">
		 
						 <div class="input_up_img">
								<a href="__ROOT__/{:C('UU_IMG_CATEGORY_DIR')}{$show.c_pic}" target="_blank">
								<img src="__ROOT__/{:C('UU_IMG_CATEGORY_DIR')}{$show.c_pic}" border="0" />
								</a>
								<div class="del" id="J_del">删除</div>
						</div>
						
						<div class="input_up_btn" id="input_up_btn" name="category_img" title="上传图片" style="display:none"></div>
			 			<div class="clear"></div>
						
		 <else />
		 
					<div class="input_up_btn" id="input_up_btn" name="category_img" title="上传图片"></div>
			 		<div class="clear"></div>
			 
			 </if>
		</div>
		
		
		 <div class="fl"></div>
		<div class="fr">
		<input name="" type="submit" class="admin_submit big"    value="保存分类"/>
		</div>
		
		
		
		<div class="clear"></div>
		
	  </div>
  
  
      <div id="J_cat_from"></div>
	  
  </form>
</div>


<div id="J_cat_select" style="display:none">

	  <div class="showdialog">
		<div class="dtit">请选择分类</div>
		  <div class="dlistx" id="0" >顶级分类</div>
		  <volist name="catlist" id="catlist">
		<div class="dlistx" id="{$catlist.c_id}">{$catlist.c_title}</div>
		 </volist>
		<div class="clear"></div>
	  </div>
	  
</div>


<include file="public:footer" />
<script type="text/javascript">
	var uploadUrl = "__ROOT__/index.php?m=home&c=Upload&a=img";
</script>
<script src="__ROOT__/{:C('UU_ADMINTPL_DIR')}/public/js/ajaxfileupload.js"></script>
<script src="__ROOT__/{:C('UU_ADMINTPL_DIR')}/public/js/fileupload.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
 $(".J_cat_show").dialog({
  DialogAddObj:"#J_cat_from",
  DialogTitle:"请选择所属分类",
  DialogContent:"#J_cat_select",
  DialogContentType:"id"
  });
    
$('#J_cat_from .dlistx').live('click',function() {
  $("#c_pid_cn").val($(this).html());
  $("#c_pid").val($(this).attr('id'));
  $(" .FloatBg").remove();
  $(" .FloatBox").remove();
});
//删除上传图片
	$('#J_del').live('click',function() {
	
	 	$(".input_up_btn").show();
		$(".input_up_img").hide();
		$("input[name=c_pic]").val('');
	});
// 上传图标

$.upload('#input_up_btn',{type:'category_img'},function(result){
		html="";
		html+="<div class=\"input_up_img\">";
		html+="<a href=\"__ROOT__/{:C('UU_IMG_CATEGORY_DIR')}5896b962c92cc.jpg\" target=\"_blank\"><img src=\"__ROOT__/{:C('UU_IMG_CATEGORY_DIR')}5896b962c92cc.jpg\" border=\"0\" /></a>";
		html+="<div class=\"del\" id=\"J_del\">删除</div>";
		html+="</div>";
		if(result.status == 1){
			//disapperTooltip("success", "图片上传成功!");
			$("#up_img_show").prepend(html);
			$(".input_up_img").find('a').attr('href',result.content.src);
			$(".input_up_img").find('img').attr('src',result.content.src);
			$(".input_up_btn").hide();			
			$("input[name=c_pic]").val(result.content.savename);
			
		} else {
			disapperTooltip("remind", "上传失败："+result.content);
		}
	});

});
</script>
</body>
</html>